import request from "@/service/request";
import { PromisePageResponse } from "@/service/api/type.ts";
import { SysLoginLogVo } from "@/service/api/system/loginLog/types.ts";

/**
 * 获取登录日志
 * @param query
 */
const getLoginLogList = (query: any): PromisePageResponse<SysLoginLogVo> => {
  return request({
    url: "/system/loginLog/list",
    method: "get",
    params: query,
  });
};

/**
 * 获取登录日志详情
 * @param id
 */
const getLoginLogDetail = (id: string) => {
  return request({
    url: `/system/loginLog/${id}`,
    method: "get",
  });
};

/**
 * 批量删除
 * @param ids
 */
const deleteLoginLog = (ids: string | string[]) => {
  return request({
    url: `/system/loginLog/${ids}`,
    method: "delete",
  });
};

/**
 * 清空日志
 */
const cleanLoginLog = () => {
  return request({
    url: `/system/loginLog/clean`,
    method: "delete",
  });
};

export { getLoginLogList, getLoginLogDetail, deleteLoginLog, cleanLoginLog };
